# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Dumitru Ursu <dima@ceata.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - added -fsigned-char to CXXFLAGS

pkgname=opencolorio
pkgver=2.3.2
pkgrel=3
pkgdesc="A color management framework for visual effects and animation"
arch=('x86_64')
url="https://opencolorio.org"
license=('BSD')
depends=('freeglut' 'glew' 'lcms2' 'tinyxml' 'yaml-cpp' 'imath' 'pystring' 'minizip-ng' 'openexr')
makedepends=('cmake' 'python' 'pybind11' 'ninja')
checkdepends=('openimageio')
optdepends=('python: python bindings')
source=($pkgname-$pkgver.tar.gz::https://github.com/AcademySoftwareFoundation/OpenColorIO/archive/v$pkgver.tar.gz)
sha512sums=('4c7547960623b058398a86d9c8335d31f2354a1ee7ba58fbc2d1ace698132b99e8f823c9b443a77545721da076569228f502f1f3f4deba44659571c6d12db133')

build() {
  cd OpenColorIO-$pkgver

  CXXFLAGS+=" -ffat-lto-objects -fsigned-char"
  cmake \
    -GNinja \
    -Bbuild \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DCMAKE_SKIP_INSTALL_RPATH=YES \
    -Wno-dev
  ninja -C build
}

check() {
  cd OpenColorIO-$pkgver/build

  # Currently broken
  # ctest -E test_gpu
}

package() {
  cd OpenColorIO-$pkgver

  DESTDIR="$pkgdir" ninja -C build install
  install -Dm644 LICENSE $pkgdir/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
